<template>
	<view class="box">
	<view class="" style="padding: 0 24rpx;">
		<keyboard-plate ref="plateNumber" :plateNum.sync='plateNum' @change="getPlateNum" class="keyboard"  isShow></keyboard-plate>
	</view>	

<view  class="radios">
	
	<u-checkbox-group>
		<u-checkbox v-model="checks" shape="circle">中大型车辆（黄牌车）</u-checkbox>
	</u-checkbox-group>
</view>
	
	<view class="switch d_f j_c_s_b">
		<view class="car">
			设为默认车辆
		</view>
		<view class="">
			<u-switch v-model="checked"></u-switch>
		</view>
			
	</view>
	<view class=""  >
		<button type="primary"  :disabled="length>=7?!disabled:disabled" class="button" @tap.stop="sure()" shape="circle" >确定添加</button>
	</view>
	
			
	</view>
</template>

<script>
	export default {
	    data() {
	        return {
				checks:false,
	        
				value:'',
				disabled:true,//按钮控制
				checked:false,
				length:0,//车牌长度
				platevalue:"",//车牌
				    plateNum:'',
				listx:[]
	        };
	    },
	    watch:{
	        plateNum(e){
				this.length=e.length
	            console.log(e.length,e)
				this.platevalue=e
	        }
	    },
	    methods: {
		
	        //获取车牌
	        getPlateNum(e){
	          
				this.platevalue=e
	        },
			sure(){
				console.log(this.platevalue)
				uni.navigateTo({
					url:'/pages/my_car/my_car'
				})
				
				this.listx.unshift({
						'value': this.listx.length+1,
						'label': this.platevalue
					})
				
				
				uni.setStorageSync('listx',this.listx)
				
			}
	        // 打开车牌选择器
	        // carInputClick() {
	        //     this.$refs.plateNumber.open();
	        // },
	    },
		onShow() {
			if(uni.getStorageSync('listx')){
				console.log(uni.getStorageSync('listx'))
				this.listx=uni.getStorageSync('listx')
			}
		}
	}
</script>

<style>
	
	.box{
		height: 100%;
		
		
	}
	.radios{
		margin-left: 380rpx;
	}
	.switch{
	
		padding: 46rpx 32rpx 0 32rpx;
	}
	.car{
	
	font-size: 32rpx;

	color: #727681;
	}
	.button{
		margin-top: 72rpx;
		margin-left: 32rpx;
			width: 682rpx;
			height: 97rpx;
			line-height: 97rpx;
			
			border-radius: 48rpx;
			text-align: center;
			font-size: 30rpx;
			font-weight: bold;
			color: #FFFFFF;
	}
</style>